package edu.cmu.aes.project2.ws.warehouse;

public class WarehouseServiceProxy implements edu.cmu.aes.project2.ws.warehouse.WarehouseService {
  private String _endpoint = null;
  private edu.cmu.aes.project2.ws.warehouse.WarehouseService warehouseService = null;
  
  public WarehouseServiceProxy() {
    _initWarehouseServiceProxy();
  }
  
  public WarehouseServiceProxy(String endpoint) {
    _endpoint = endpoint;
    _initWarehouseServiceProxy();
  }
  
  private void _initWarehouseServiceProxy() {
    try {
      warehouseService = (new edu.cmu.aes.project2.ws.warehouse.WarehouseServiceServiceLocator()).getWarehouseServicePort();
      if (warehouseService != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)warehouseService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)warehouseService)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (warehouseService != null)
      ((javax.xml.rpc.Stub)warehouseService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public edu.cmu.aes.project2.ws.warehouse.WarehouseService getWarehouseService() {
    if (warehouseService == null)
      _initWarehouseServiceProxy();
    return warehouseService;
  }
  
  public boolean instock() throws java.rmi.RemoteException{
    if (warehouseService == null)
      _initWarehouseServiceProxy();
    return warehouseService.instock();
  }
  
  public boolean orderApprove(edu.cmu.aes.project2.ws.warehouse.Order arg0) throws java.rmi.RemoteException{
    if (warehouseService == null)
      _initWarehouseServiceProxy();
    return warehouseService.orderApprove(arg0);
  }
  
  public boolean orderApproveRollBack(edu.cmu.aes.project2.ws.warehouse.Order arg0) throws java.rmi.RemoteException{
    if (warehouseService == null)
      _initWarehouseServiceProxy();
    return warehouseService.orderApproveRollBack(arg0);
  }
  
  
}